let spurl = 'http://localhost:8080/api/v1';


function mylink(type, url, data, call) {
  let format = data instanceof FormData;
  if (format) {
    mytu(type, url, data, call)
  } else (
    myAjax(type, url, data, call)
  )
}
function myAjax(type, url, data, call) {
  $.ajax({
    url: spurl + url,
    type: type,
    data: data,
    headers: { Authorization: localStorage.getItem('mi') },
    success: function (resData) {
      if (resData.code == 403) {
        window.parent.location = "./login.html";
        return;
      }
      call(resData);
    }
  });
}
function mytu(type, url, data, call) {
  $.ajax({
    url: spurl + url,
    type: type,
    data: data,
    processData: false,
    contentType: false,
    headers: { Authorization: localStorage.getItem('mi') },
    success: function (resData) {
      if (resData.code == 403) {
        window.parent.location = "./login.html";
        return;
      }
      call(resData);
    }
  });
}